<?php 
session_start(); 
      if (isset($_SESSION['k_username'])) {
include('../../conexion.inc.php');
$link = Conectarse();
mysql_select_db("gotica_sociosgotica",$link);	  ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tareas</title>
<link href="../../css/style1.css" rel="stylesheet" type="text/css" media="all" />
<link rel="stylesheet" type="text/css" media="all" href="../../calendario/calendar-green.css" title="win2k-cold-1" /> 
 <!-- librería principal del calendario -->
 <script type="text/javascript" src="../../calendario/calendar.js"></script>

 <!-- librería para cargar el lenguaje deseado -->
  <script type="text/javascript" src="../../calendario/lang/calendar-es.js"></script>

  <!-- librería que declara la función Calendar.setup, que ayuda a generar un calendario en unas pocas líneas de código -->
  <script type="text/javascript" src="../../calendario/calendar-setup.js"></script>    
<script type="text/javascript" src="../../js/funciones.js"></script>


</head>

<body>
<h1>Admnistrar Tareas</h1>
<b>Dejar Tarea</b>
<form id="form1" name="form1" method="post" action="dejala.php">
 <table>
  <?
$fecha = date("y-m-d");
echo "<tr><td colspan=4>Fecha<input name=\"fecha\" id=\"fecha\" type=\"text\" value=\"".$fecha."\" maxlength=\"10\" /><input type=\"button\"  value=\"...\" onclick=\"return showCalendar('fecha', '%Y-%m-%d' , '24', true);\" /> </td> ";
$user=$_SESSION['k_username'];
echo "<input type=\"hidden\"  value=\"$user\" name=\"pide\"  /> </tr> ";
echo "<tr><td><select name=\"realiza\" > ";
$sql1 = "SELECT * FROM usuarios ";
$result1 = mysql_query($sql1, $link);
while ($row1 = mysql_fetch_array($result1))
{
echo "<option value=\"".$row1['usuario']."\">";
echo $row1['descripcion'];
echo "</option>";
}
echo "</select></td></tr>";
?>
<tr>
<td>
<textarea name="descripcion" cols="40" rows="5" dir="ltr" lang="es"></textarea>
</td></tr>
<tr>
<td>
<input type="submit" value="Enviar" name="enviar" />
</td>
<td>
<input type="reset" value="Limpiar" />
</td>
</tr>
</table>
</form>
 <b>Tareas Dejadas</b>
 <? 
 $sqlt="SELECT * FROM tareas WHERE idPide='$user'";
 $resultt = mysql_query($sqlt, $link);
 echo "<table><tr class=\"dataheader\" >";
 echo "<td>Editar</td><td>Eliminar</td><td>Por Realizar</td><td>Tarea</td><td>Fecha</td><td>Realizada</td></tr>";
 while ($rowt = mysql_fetch_array($resultt)){
 echo"<tr class=\"data\" align=\"center\">";
echo "<form method=\"post\" action=\"edittarea.php\">";
echo "<input type=\"hidden\" value=".$rowt['idtarea']." name=\"valor\" />";
echo "<td><input type=\"submit\" class=\"buttonmi\"  name=\"editar\" value=\"Editar\" /></td>";
echo "</form>";
echo "<form method=\"post\" action=\"borratarea.php\">";
echo "<input type=\"hidden\" value=".$rowt['idtarea']." name=\"valor\" />";
echo "<td><input type=\"submit\" class=\"buttonmi\"  name=\"borrar\" value=\"Borrar\" /></td>";
echo "</form>";
echo "<td>".$rowt['idRealiza']."</td>";
echo "<td>".$rowt['T_descripcion']."</td>";
echo "<td>".$rowt['Fecha']."</td>";
if ($rowt['T_descripcion']==1){
echo "<td>Si</td>";}
else
{
echo "<td>No</td>";
}
  echo "</tr>";
 }
 echo "</table>";
 ?>
</body>

</html>
<?
}else
{
	echo "<SCRIPT LANGUAGE=\"javascript\">";
echo "location.href = \"index.php\"";
echo "</SCRIPT>";
	}
?>
